package com.ssy.lingxi.order.api.feign;

import com.ssy.lingxi.common.response.PageData;
import com.ssy.lingxi.common.response.Wrapper;
import com.ssy.lingxi.order.api.model.vo.request.*;
import com.ssy.lingxi.order.api.model.vo.response.*;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.validation.Valid;
import java.util.List;

/**
 * 订单服务 - OpenFeign接口
 * @author 万宁
 * @version 2.0.0
 * @date 2021-07-31
 */
@FeignClient(name = "order-service")
public interface OrderFeignService {
    /**
     *  查询（供应）会员交易流程规则配置
     * @param feignVO 接口参数
     * @return 查询结果
     */
    @RequestMapping(value = "/order/feign/trade/process/find", method = RequestMethod.POST)
    Wrapper<OrderTradeProcessFeignDetailVO> findVendorTradeProcess(@RequestBody @Valid OrderTradeProcessFeignVO feignVO);

    /**
     * 查询（采购）会员采购流程规则配置
     * @param feignVO 接口参数
     * @return 查询结果
     */
    @RequestMapping(value = "/order/feign/purchase/process/find", method = RequestMethod.POST)
    Wrapper<OrderPurchaseProcessFeignDetailVO> findBuyerPurchaseProcess(@RequestBody @Valid OrderPurchaseProcessFeignVO feignVO);

    /**
     * 查询平台后台 - 会员支付策略设置
     * @param feignVO 接口参数
     * @return 查询结果
     */
    @RequestMapping(value = "/order/feign/platform/payment/find", method = RequestMethod.POST)
    Wrapper<List<PlatformPayTypeFeignDetailVO>> findPlatformPayments(@RequestBody @Valid OrderMemberFeignVO feignVO);

    /**
     * 查询支付参数
     * @param feignVO 接口参数
     * @return 查询结果
     */
    @RequestMapping(value = "/order/feign/payment/parameter/find", method = RequestMethod.POST)
    Wrapper<PaymentParameterFeignDetailVO> findPaymentParameters(@RequestBody @Valid OrderPayParameterFeignVO feignVO);

    /**
     * 查询支付参数（直接查询平台支付参数配置）
     * @param feignVO 接口参数
     * @return 查询结果
     */
    @RequestMapping(value = "/order/feign/platform/payment/parameter/find", method = RequestMethod.POST)
    Wrapper<PaymentParameterFeignDetailVO> findPlatformPaymentParameters(@RequestBody @Valid OrderPayChannelFeignVO feignVO);

    /**
     * 查询支付参数（直接查询会员支付参数配置）
     * @param feignVO 接口参数
     * @return 查询结果
     */
    @RequestMapping(value = "/order/feign/member/payment/parameter/find", method = RequestMethod.POST)
    Wrapper<PaymentParameterFeignDetailVO> findMemberPaymentParameters(@RequestBody @Valid OrderPayParameterFeignVO feignVO);

    /**
     * 售后服务 - 更新订单商品的换货、退货、维修数量、退款金额
     * @param afterSales 接口参数
     * @return 更新结果
     */
    @RequestMapping(value = "/order/feign/after/sale/update", method = RequestMethod.POST)
    Wrapper<Void> updateAfterSaleOrderProduct(@RequestBody @Valid List<OrderAfterSaleVO> afterSales);

    /**
     * 售后服务 - 更新订单商品的实际退款金额
     * @param orderReturnAmountUpdateVO 退款信息V0
     * @return 更新结果
     */
    @RequestMapping(value = "/order/feign/after/update/refund/amount", method = RequestMethod.POST)
    Wrapper<Void> updateAfterSaleOrderProductAmount(@RequestBody OrderReturnAmountUpdateVO orderReturnAmountUpdateVO);

    /**
     * 售后服务 - 查询订单商品的换货、退货、维修数量、退款金额
     * @param orderProductIds 订单商品Id列表
     * @return 查询结果
     */
    @RequestMapping(value = "/order/feign/after/sale/find", method = RequestMethod.POST)
    Wrapper<List<OrderAfterSaleProductFeignDetailVO>> findAfterSaleOrderProducts(@RequestBody @Valid List<OrderProductIdFeignVO> orderProductIds);

    /**
     * 售后服务 - 批量查询订单外部状态
     * @param feignVO 订单Id列表
     * @return 查询结果
     */
    @RequestMapping(value = "/order/feign/after/sale/status/find", method = RequestMethod.POST)
    Wrapper<List<OrderAfterSaleStatusVO>> findAfterSaleOrderStatuses(@RequestBody @Valid OrderIdsFeignVO feignVO);

    /**
     * 售后服务 - 根据合同Id查询订单列表
     * @param feignVO 接口参数
     * @return 查询结果
     */
    @RequestMapping(value = "/order/feign/after/sale/contract/find", method = RequestMethod.POST)
    Wrapper<List<OrderAfterSaleOrderContractFeignVO>> findAfterSaleOrderContracts(@RequestBody @Valid OrderContractFeignVO feignVO);

    /**
     * 售后能力 - 查询已经确认支付结果的支付记录列表
     * @param feignVO 接口参数
     * @return 查询结果
     */
    @RequestMapping(value = "/order/feign/after/sale/payment/find", method = RequestMethod.POST)
    Wrapper<List<OrderAfterSalePaymentFeignDetailVO>> findAfterSaleOrderPayments(@RequestBody @Valid OrderIdsFeignVO feignVO);

    /**
     * 物流能力 - 确认物流单后，更新订单的物流单号
     * @param feignVO 接口参数
     * @return 更新结果
     */
    @RequestMapping(value = "/order/feign/logistics/update", method = RequestMethod.POST)
    Wrapper<Void> updateOrderLogisticsNo(@RequestBody @Valid OrderUpdateLogisticsNoFeignVO feignVO);

    /**
     * 加工能力 - 更新订单商品加工数量
     * @param feigns 接口参数
     * @return 更新结果
     */
    @RequestMapping(value = "/order/feign/enhance/update", method = RequestMethod.POST)
    Wrapper<Void> updateOrderProductEnhanceCount(@RequestBody @Valid List<OrderUpdateEnhanceFeignVO> feigns);

    /**
     * 结算服务 - 查询订单发票信息
     * @param feignVO 接口参数
     * @return 查询结果
     */
    @RequestMapping(value = "/order/feign/settle/account/invoice/find", method = RequestMethod.POST)
    Wrapper<OrderSettleAccountInvoiceFeignDetailVO> findSettleAccountInvoiceDetail(@RequestBody @Valid OrderNoFeignVO feignVO);

    /**
     * 会员服务 - 订单评论完成后，更改订单评论状态
     * @param feignVO 接口参数
     * @return 修改结果
     */
    @RequestMapping(value = "/order/feign/member/comment", method = RequestMethod.POST)
    Wrapper<Void> updateOrderComment(@RequestBody @Valid OrderCommentFeignVO feignVO);

    /**
     * 支付服务 - 订单服务回调
     * @param callbackFeignVO 回调参数
     * @return 操作结果
     */
    @RequestMapping(value = "/order/feign/pay/callback", method = RequestMethod.POST)
    Wrapper<Void> orderPayCallback(@RequestBody @Valid OrderPayCallbackFeignVO callbackFeignVO);

    /**
     * 售后服务 - 订单会员信息校验
     * @param checkVO 请求参数
     * @return 操作结果
     */
    @RequestMapping(value = "/order/feign/after/sale/order/member/check", method = RequestMethod.POST)
    Wrapper<Boolean> checkAfterSaleOrderMember(@RequestBody @Valid CheckOrderMemberAfterSaleVO checkVO);

    /**
     * 结算服务 - 平台结算支付方式列表
     * @return 平台结算支付方式列表
     */
    @RequestMapping(value = "/order/feign/settle/accounts/settlement/type/list", method = RequestMethod.POST)
    Wrapper<List<PlatformSettlementTypeVO>> findSettlementType();

    /**
     * 结算服务 - 平台结算渠道方式列表
     * @param request 接口参数
     * @return 平台结算渠道方式列表
     */
    @RequestMapping(value = "/order/feign/settle/accounts/settlement/channel/list", method = RequestMethod.POST)
    Wrapper<List<MemberSettleChannelVO>> findSettlementChannel(@RequestBody @Valid MemberSettleChannelQueryVO request);

    /**
     * 所有服务通用 - 查询平台规则配置
     * @param feignVO 查询条件
     * @return 查询结果
     */
    @RequestMapping(value = "/order/feign/rules/find", method = RequestMethod.POST)
    Wrapper<List<OrderRuleDetailVO>> findOrderRules(@RequestBody OrderRuleDetailFeignVO feignVO);

    /**
     * 营销服务 - 查询订单商品信息
     * @param feignVO 查询条件
     * @return 查询结果
     */
    @RequestMapping(value = "/order/feign/marketing/products/find", method = RequestMethod.POST)
    Wrapper<List<OrderMarketingDetailVO>> findOrderMarketingProducts(@RequestBody OrderMarketingFeignVO feignVO);

    /**
     * 会员服务 - 查询订单供应会员会员Logo、或店铺Logo、或自营商城Logo
     * @param feignVO 接口参数
     * @return 修改结果
     */
    @RequestMapping(value = "/order/feign/vendor/logo", method = RequestMethod.POST)
    Wrapper<List<OrderVendorLogoFeignVO>> findOrderVendorLogo(@RequestBody OrderFeignIdsVO feignVO);

    /**
     * 结算服务 - 新增请款单-查询请款类型和付款方过滤采购订单数据
     * @param pageVO  接口参数
     * @return 查询结果
     */
    @RequestMapping(value = "/order/feign/settle/buyer/order/page", method = RequestMethod.POST)
    Wrapper<PageData<OrderBuyerSettleQueryVO>> pageSettleBuyerOrders(@RequestBody @Valid OrderBuyerSettlePageVO pageVO);

    /**
     * 结算服务 - 付款完成后修改订单收发货记录状态为已结算
     * @param feignVO 接口参数
     * @return 查询结果
     */
    @RequestMapping(value = "/order/feign/settle/deliveries/update", method = RequestMethod.POST)
    Wrapper<Void> updateOrderDeliveries(@RequestBody @Valid OrderUpdateDeliveriesFeignVO feignVO);

    /**
     * 结算服务 - 协同对账 - 对账单生成请款单采购订单数据
     * @param feignVO 接口参数
     * @return 查询结果
     */
    @RequestMapping(value = "/order/feign/settle/reconciliation/buyer/order", method = RequestMethod.POST)
    Wrapper<List<OrderBuyerSettleReconciliationFeignVO>> settleReconciliationBuyerOrders(@RequestBody @Valid OrderFeignIdsVO feignVO);

    /**
     * “售后服务” - 查询订单商品使用“平台优惠券”后的优惠抵扣金额
     * @param feignVO 接口参数
     * @return 查询结果
     */
    @RequestMapping(value = "/order/feign/after/sale/platform/coupon/find", method = RequestMethod.POST)
    Wrapper<List<OrderProductCouponFeignVO>> findOrderProductCouponAmounts(@RequestBody @Valid OrderFeignIdsVO feignVO);

    /**
     * “搜索服务” - 批量查询会员满额包邮配置
     * @param feignVO 接口参数
     * @return 查询结果
     */
    @RequestMapping(value = "/order/feign/search/member/free/express/config/list", method = RequestMethod.POST)
    Wrapper<List<OrderFreeExpressConfigVO>> getOrderFreeExpressConfigList(@RequestBody @Valid OrderFreeExpressFeignVO feignVO);

    /**
     * 根据物料信息查询订单(商品能力- 物料价格库)
     * @author lxc
     * @date 2022/4/2
     **/
    @RequestMapping(value = "/order/feign/goodsPrice/by/goods", method = RequestMethod.POST)
    Wrapper<OrderPriceQueryVO> goodsPriceByGoods(@RequestBody @Valid OrderPriceQueryRequest request);
}
